﻿@using CJAtech.BBS.DataEntity;
@using TjZheng.Domain.DataEntity;
@inherits CMSWebViewPage<ArticleInfo>
@{
    ViewBag.Title = "编辑文章用户_奔驰";
    Layout = "~/Views/Shared/_EditLayout.cshtml";
    DbSetInfo objDbSetInfo = ViewBag.DbSetInfo as DbSetInfo;
}
@section Head{
    @*@Html.CreateDialogSource()*@
    @*@Html.CreateUpLoadSource()*@
    @*@Html.CreateEditorSource()*@
    <script src="/Content/js/bizdatagrid.js"></script>
}
<div class="easyui-layout" data-options="fit:true">
    <div data-options="region:'center',border:false" class="xhidden">
        <div class="top-block">
            @CurrentButtonTool.Create()
        </div>
        <div style="margin-left: 5px;">
            <div style="border: 1px solid #c3d9e0; width: 1000px;">
                <form id="fr_benzuserinfo" method="post">
                    <table class="tblContent">
                        <colgroup>
                            <col class="colTitle" />
                            <col class="colContent" />
                            <col class="colTitle" />
                            <col class="colContent" />
                        </colgroup>
                        <tr>
                            <td><span class="txtNoNull">*</span>用户ID:</td>
                            <td>
                                @Html.Hidden("S1", Model.S1)
                                @Html.StringBox("ObjectId", Model.ObjectId, true, "请输入用户ID", new { style = "width:300px;" }, ValidType.Length(64))
                            </td>
                            <td><span class="txtNoNull">*</span>用户名称:</td>
                            <td>
                                @Html.StringBox("ArticleAuthor", Model.ArticleAuthor, true, "请输入作者名称", null, ValidType.Length(64))
                            </td>
                        </tr>
                    </table>
                </form>
            </div>
            <div id="toolbar_benzuserinfo" class="datagrid-toolbar">
                <div>
                    <form id="fr_search_benzuserinfo">
                        用户名称：@Html.StringBox("param", Model.ArticleAuthor, false, "")
                        <a onclick="Search();" class="easyui-linkbutton" data-options="iconCls:'icon-search',plain:true"></a>
                        <span class="txtNoNull">请双击选中添加用户</span>
                    </form>
                </div>
            </div>
            <table id="dg_benzuserinfo" data-options="url:'/bbs/articleinfo/benzuserjson?setid=2&param=@Model.ArticleAuthor',border:true,fitColumns:true,toolbar:'#toolbar_benzuserinfo',singleSelect:true,pagination:true,pageSize:20,width:1000,height:400,onDblClickRow:SelectUser">
                <thead>
                    <tr>
                        <th data-options="field:'ck',checkbox:true"></th>
                        <th data-options="field:'ID',width:80,align:'center'">主键</th>
                        <th data-options="field:'Name',width:50,align:'center'">用户名称</th>
                        <th data-options="field:'CardNO',width:60,align:'center'">身份证号</th>
                        <th data-options="field:'OfficerName',width:60,align:'center'">职称</th>
                        <th data-options="field:'CompanyName',width:80,align:'center'">公司名称</th>
                    </tr>
                </thead>
            </table>
        </div>
    </div>
</div>
@section Bottom{
    <script type="text/javascript">
        var objBizDatagrid = new BizDatagrid('#dg_benzuserinfo');
        function SelectUser(index, row) {
            if (row == null) {
                ShowMessage("请选择用户");
                return;
            }
            $("#S1").val(row.Avatar);
            $("#ObjectId").val(row.ID);
            $("#ArticleAuthor").val(row.Name);
        }
        function Save() {
            var objFormEntity = new FormEntity("#fr_benzuserinfo");
            objFormEntity.url = "/bbs/articleinfo/saveuser?id=@Model.ArticleId&setid=@objDbSetInfo.SetId";
            objFormEntity.submitSuccess = function (InvokeResult) {
                if (InvokeResult.ResultCode == "Success") {
                    ShowMessage(InvokeResult.ResultMessage);
                    Back();
                } else {
                    ShowMessage(InvokeResult.ResultMessage);
                }
            };
            objFormEntity.isClearData = false;
            objFormEntity.submit();
        }
        function Search() {
            objBizDatagrid.search('#fr_search_benzuserinfo', '/bbs/articleinfo/benzuserjson?setid=2');
        }
        function Back() {
            TransferToUrl("/bbs/articleinfo?SetId=@objDbSetInfo.SetId");
        }
    </script>
}